
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">

			<p:toolbar  >
				<p:toolbarGroup align="left">
					<p:commandButton  value="#{messages['button.save']}" action="#{clienteEditMB.insert}"
						rendered="#{!clienteEditMB.updateMode}" ajax="false" />
					<p:commandButton  value="#{messages['button.save']}" action="#{clienteEditMB.update}"
						rendered="#{clienteEditMB.updateMode}" ajax="false" />
					<p:commandButton  value="#{messages['button.delete']}" onclick="confirmation.show()"
						rendered="#{clienteEditMB.updateMode}" type="button" immediate="true" ajax="false" />
					<p:dialog style="position: absolute; left:50px; top:50px;"  message="#{messages['label.confirm.delete']}" showEffect="bounce" hideEffect="explode"
						header="#{messages['label.dialog.delete']}" severity="alert" widgetVar="confirmation">
						<h:commandButton value="#{messages['button.dialog.yes']}" action="#{clienteEditMB.delete}" immediate="true"
							ajax="false" />
						<h:commandButton value="#{messages['button.dialog.no']}" onclick="confirmation.hide()" type="button" />
					</p:dialog>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset style="width:98%; -webkit-border-radius: 8px; -moz-border-radius: 8px;border-radius: 8px;" legend="#{messages['cliente.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="3">
					
					<h:outputLabel value="#{messages['cliente.label.id']}: " for="id" styleClass="text-input" />
					<h:outputText id="id" value="#{clienteEditMB.bean.id}" />
					<p:message for="id" />

					<h:outputLabel value="#{messages['cliente.label.nome']}: " for="nome" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="nome" value="#{clienteEditMB.bean.nome}"   required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="60" maxlength="50"
						title="#{messages['cliente.alt.nome']}" />
					<p:message for="nome" />

					<h:outputLabel value="#{messages['cliente.label.responsavel']}: " for="responsavel" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="responsavel" value="#{clienteEditMB.bean.responsavel}" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="60" maxlength="50"
						title="#{messages['cliente.alt.responsavel']}" />
					<p:message for="responsavel" />

					<h:outputLabel value="#{messages['cliente.label.email']}: " for="email" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="email" value="#{clienteEditMB.bean.email}" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="60" maxlength="50"
						title="#{messages['cliente.alt.email']}" />
					<p:message for="email" />

					<h:outputLabel value="#{messages['cliente.label.fone']}: " for="fone" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="fone" value="#{clienteEditMB.bean.fone}"   required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="15" maxlength="14"
						title="#{messages['cliente.alt.fone']}" />
					<p:message for="fone" />

					<h:outputLabel value="#{messages['cliente.label.fone2']}: " for="fone2" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="fone2" value="#{clienteEditMB.bean.fone2}"  size="15" maxlength="14"
						title="#{messages['cliente.alt.fone2']}" />
					<p:message for="fone2" />

					<h:outputLabel value="#{messages['cliente.label.fone3']}: " for="fone3" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="fone3" value="#{clienteEditMB.bean.fone3}" size="15" maxlength="14"
						title="#{messages['cliente.alt.fone3']}" />
					<p:message for="fone3" />

					<h:outputLabel value="#{messages['cliente.label.cpf']}: " for="cpf" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="cpf" value="#{clienteEditMB.bean.cpf}" size="21" maxlength="20" 
						converterMessage="#{messages['mensagem_geral.parametroInvalido']}"
						validatorMessage="#{messages['mensagem_geral.parametroInvalido']}" 
						converter="cpfCnpjConverter"
						title="#{messages['cliente.alt.cpf']}" />
					<p:message for="cpf" />

					<h:outputLabel value="#{messages['cliente.label.endereco']}: " for="endereco" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="endereco" value="#{clienteEditMB.bean.endereco}"  required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" maxlength="100" size="60"
						title="#{messages['cliente.alt.endereco']}" />
					<p:message for="endereco" />
					
					<h:outputLabel value="#{messages['cliente.label.complemento']}: " for="complemento" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="complemento" value="#{clienteEditMB.bean.complemento}"  maxlength="100" size="40"
						title="#{messages['cliente.alt.complemento']}" />
					<p:message for="complemento" />
					
					<h:outputLabel value="#{messages['cliente.label.referencia']}: " for="referencia" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="referencia" value="#{clienteEditMB.bean.referencia}" maxlength="100" size="40"
						title="#{messages['cliente.alt.referencia']}" />
					<p:message for="referencia" />
					
					<h:outputLabel value="#{messages['cliente.label.bairro']}: " for="bairro" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="bairro" value="#{clienteEditMB.bean.bairro}"   required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="40" maxlength="50"
						title="#{messages['cliente.alt.bairro']}" />
					<p:message for="bairro" />
					
					<h:outputLabel value="#{messages['cliente.label.cep']}: " for="cep" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="cep" value="#{clienteEditMB.bean.cep}"  required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="40" maxlength="50"
						title="#{messages['cliente.alt.cep']}" />
					<p:message for="cep" />

					<h:outputLabel value="#{messages['cliente.label.cidade']}: " for="cidade" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="cidade" value="#{clienteEditMB.bean.cidade}"   required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="40" maxlength="50"
						title="#{messages['cliente.alt.cidade']}" />
					<p:message for="cidade" />
					
					<h:outputLabel value="#{messages['cliente.label.estado']}: " for="estado" styleClass="text-input" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="estado" value="#{clienteEditMB.bean.estado}"   required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" size="3" maxlength="2"
						title="#{messages['cliente.alt.estado']}" />
					<p:message for="estado" />

					<h:outputLabel value="#{messages['cliente.label.desconto']}: " for="desconto" styleClass="text-input" rendered="#{loginMB.temPermissao('22')}" />
					<h:inputText   onkeypress="if (event.keyCode == 13) { return false; }" id="desconto" required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}" value="#{clienteEditMB.bean.desconto}" size="10"  maxlength="40"  rendered="#{loginMB.temPermissao('22')}" 
						title="#{messages['cliente.alt.desconto']}" styleClass="mask-moeda20" >
						<f:converter converterId="bigDecimalConversor"/>
					</h:inputText>
					<p:message for="desconto"  rendered="#{loginMB.temPermissao('22')}" />
					
					<h:outputLabel value="#{messages['cliente.label.resgataUltimoPedido']}: " for="resgataUltimoPedido" styleClass="text-input" />
					<h:selectOneRadio styleClass="tableRadios" id="resgataUltimoPedido" value="#{clienteEditMB.bean.resgataUltimoPedido}" 
				    	required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">  
			             <f:selectItem itemLabel="Sim" itemValue="1" />
			             <f:selectItem itemLabel="Não" itemValue="2" />
			         </h:selectOneRadio>
					<p:message for="resgataUltimoPedido" />
					
					<h:outputLabel value="#{messages['cliente.label.tipoPagamento']}: " for="tipoPagamento" styleClass="text-input" />
					<h:selectOneRadio styleClass="tableRadios" id="tipoPagamento" value="#{clienteEditMB.bean.tipoPagamento}" 
				    	required="true" requiredMessage="#{messages['mensagem_geral.campoObrigatorio']}">  
			             <f:selectItem itemLabel="A VISTA" itemValue="1" />
			             <f:selectItem itemLabel="FATURADO" itemValue="0" />
			         </h:selectOneRadio>
					<p:message for="tipoPagamento" />
					
				</h:panelGrid>
			</p:fieldset>
		</h:form>
	</ui:define>
</ui:composition>